import { Component, useEffect } from 'react';
import styles from './index.less';
import {useDispatch, useSelector} from 'umi'
import {Button,Table} from 'antd'
import { PlusOutlined } from '@ant-design/icons';
import { CategoryModelState } from '@/models/category';
export default function category() {
  const { categoryList } = useSelector((state: { category: CategoryModelState }) => state.category);
   console.log('categoryList',categoryList);
   const dispatch = useDispatch();
   useEffect(() => {
    dispatch({
        type: 'category/getCategoryList',
    })
}, []);
  const dataSource = [
    {
      key: '1',
      name: '胡彦斌',
      age: 32,
      address: '西湖区湖底公园1号',
    },
    {
      key: '2',
      name: '胡彦祖',
      age: 42,
      address: '西湖区湖底公园1号',
    },
  ];
  
  const columns = [
    {
      title: '分类名称',
      dataIndex: 'name',
      key: 'name',
    },
    {
      title: '图片',
      dataIndex: 'age',
      key: 'age',
    },
    {
      title: '状态',
      dataIndex: 'address',
      key: 'address',
    },
    {
      title: '排序号',
      dataIndex: 'age',
      key: 'age',
    },
    {
      title: '操作',
      dataIndex: 'address',
      key: 'address',
    },
  ];
  return (
    <div  className={styles.content}>
      
          <div className={styles.add}>
            <Button type="primary" icon={<PlusOutlined />}>新增</Button>
          </div>
          <div>
          <Table bordered={true} dataSource={dataSource} columns={columns} />;
          </div>
    
    </div>
  );
}